Skip to content

Add support for GPT-5.5 via Azure Foundry#613

Open
ngoiyaeric wants to merge 5 commits into
mainfrom
feature/gpt-5-5-integration-3548606824986651974
Open

Add support for GPT-5.5 via Azure Foundry#613
ngoiyaeric wants to merge 5 commits into
mainfrom
feature/gpt-5-5-integration-3548606824986651974

Conversation

@ngoiyaeric
Copy link
Copy Markdown
Collaborator

@ngoiyaeric ngoiyaeric commented May 15, 2026

This PR adds support for the new GPT-5.5 model, which is hosted via Azure Foundry (Azure OpenAI-compatible).

Changes:

  • UI: Integrated GPT-5.5 into the model selection dropdown and radio group in components/settings/components/model-selection-form.tsx.
  • Backend: Updated lib/utils/index.ts to handle the GPT-5.5 model selection by initializing an OpenAI provider with the custom Azure endpoint and API key.
  • Environment: Added template variables for AZURE_ENDPOINT, AZURE_API_KEY, and AZURE_DEPLOYMENT_NAME in .env.local.example.

Verification:

  • Verified implementation details in the codebase.
  • Confirmed that the model initialization logic correctly uses the Azure Foundry baseURL pattern.
  • Attempted visual verification with Playwright; although blocked by environment-specific Mapbox token issues, the presence of the new model in the build artifacts was confirmed via grep.

PR created automatically by Jules for task 3548606824986651974 started by @ngoiyaeric

Summary by CodeRabbit

  • New Features
    • Introduced GPT-5.5 as a new Premium-tier model option in model selection (updated name, description, icon/badge).
    • Added Azure OpenAI integration support with configurable endpoint, API key, and deployment name for using Azure-hosted models.

Review Change Stack

- Added GPT-5.5 to ModelSelectionForm with premium badge and description.
- Implemented GPT-5.5 initialization in getModel using Azure OpenAI provider.
- Configured AZURE_ENDPOINT, AZURE_API_KEY, and AZURE_DEPLOYMENT_NAME environment variables.
- Updated .env.local.example with new Azure configuration.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
qcx Ready Ready Preview, Comment May 15, 2026 11:06am

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@qodo-code-review
Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@ngoiyaeric has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 25 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5d7addca-909c-4125-a147-36df9f04f7ee

📥 Commits

Reviewing files that changed from the base of the PR and between 133acf8 and 53d9088.

📒 Files selected for processing (11)
  • lib/actions/suggest.ts
  • lib/agents/inquire.tsx
  • lib/agents/query-suggestor.tsx
  • lib/agents/researcher.tsx
  • lib/agents/resolution-search.tsx
  • lib/agents/task-manager.tsx
  • lib/agents/writer.tsx
  • lib/auth/get-current-user.ts
  • lib/utils/index.ts
  • lib/utils/model.ts
  • mapbox_mcp/hooks.ts

Walkthrough

Adds GPT-5.5 as a selectable model with Azure OpenAI placeholders in the example env, updates the settings UI option, and extends getModel() to read Azure env vars, initialize an Azure OpenAI client for GPT-5.5, and change provider fallback order (Azure → Gemini → xAI) with a final OpenAI guard.

Changes

GPT-5.5 Model Support with Azure Integration

Layer / File(s) Summary
Configuration and Model Selection
.env.local.example, components/settings/components/model-selection-form.tsx
Adds AZURE_ENDPOINT, AZURE_API_KEY, and AZURE_DEPLOYMENT_NAME (gpt-5.5) placeholders; replaces the UI model entry with GPT-5.5 (updated id, name, description, icon, and badge).
Azure and Provider Initialization
lib/utils/index.ts
getModel() now reads Azure env vars, implements a GPT-5.5 branch that initializes an Azure-configured OpenAI client and returns the configured deployment, removes per-provider runtime try/catch fall-throughs, sets deterministic fallback order Azure → Gemini → xAI, adjusts Bedrock return, and adds a final guard requiring OPENAI_API_KEY before the gpt-4o fallback.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • QueueLab/QCX#389: Modifies lib/utils/index.ts provider-selection logic and interacts with Gemini/provider fallback behavior.
  • QueueLab/QCX#584: Changes provider/model-selection flow in lib/utils/index.ts, overlapping with Gemini-related code paths.

Suggested labels

Review effort 2/5

Poem

🐰 A rabbit hops with keys in paw,
GPT-5.5 now joins the draw,
Azure endpoints penned with care,
UI shimmers, configs there,
Hooray — the model's in the air!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add support for GPT-5.5 via Azure Foundry' accurately summarizes the main change—integrating a new GPT-5.5 model via Azure Foundry with corresponding UI, backend, and environment configuration updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/gpt-5-5-integration-3548606824986651974

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread lib/utils/index.ts Outdated
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add azure as the first option here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved Azure (GPT-5.5) to be the first option in the default fallback behavior in lib/utils/index.ts.

@ngoiyaeric
Copy link
Copy Markdown
Collaborator Author

@coderabbitai plan https://github.com/QueueLab/QCX/pull/613/changes#r3247081469

@google-labs-jules
Copy link
Copy Markdown
Contributor

@coderabbitai plan https://github.com/QueueLab/QCX/pull/613/changes#r3247081469

Acknowledged. I've updated the model fallback order as requested.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get the specific review comment
gh api repos/QueueLab/QCX/pulls/comments/3247081469 2>/dev/null || echo "Not a PR review comment, trying issue comment..."
gh api repos/QueueLab/QCX/issues/comments/3247081469 2>/dev/null || echo "Not an issue comment either."

# List all review comments on PR `#613`
echo "=== PR Review Comments ==="
gh api repos/QueueLab/QCX/pulls/613/comments --jq '.[] | {id: .id, body: .body, path: .path, line: .line}'

# Get the PR files changed
echo "=== PR Files Changed ==="
gh api repos/QueueLab/QCX/pulls/613/files --jq '.[] | {filename: .filename, status: .status, additions: .additions, deletions: .deletions, patch: .patch}'

Length of output: 5329


🏁 Script executed:

#!/bin/bash
cat lib/utils/index.ts

Length of output: 4919


@ngoiyaeric The review comment on Line 101 of lib/utils/index.ts says "add azure as the first option here" — meaning Azure/GPT-5.5 should be the first provider tried in the default fallback chain (the block below the switch statement), before Gemini, Grok, Bedrock, and OpenAI.

Here's the plan:

  • Update the default fallback block in lib/utils/index.ts to try Azure first
  • Update the fallback order comment to reflect the new priority

The requested changes have been implemented and a pull request has been created: View PR

- Moved Azure (GPT-5.5) to be the first option in the default fallback chain in getModel.
- Maintained support for selecting GPT-5.5 explicitly via UI settings.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
- Integrated GPT-5.5 via Azure Foundry with premium branding.
- Refactored getModel in lib/utils/index.ts for better clarity and robust error handling.
- Set Azure (GPT-5.5) as the primary provider in the fallback chain.
- Added comprehensive Azure AI configuration to .env.local.example.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
@ngoiyaeric
Copy link
Copy Markdown
Collaborator Author

@coderabbitai plan 2026-05-15 10:02:48.398 [error] getSystemPrompt: Error: TypeError: Cannot read properties of undefined (reading 'searchParams')
at (.next/server/chunks/5540.js:7:12448)
at Object.startActiveSpan (.next/server/chunks/5540.js:47:50102)
at (.next/server/chunks/5540.js:7:12284)
at Object.startActiveSpan (.next/server/chunks/5540.js:47:50102)

⨯ TypeError: Cannot read properties of undefined (reading 'call')
at Object.t [as require] (.next/server/webpack-runtime.js:1:128) {
digest: '3507941515'
}

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
echo "=== Search for getSystemPrompt ==="
rg -n "getSystemPrompt" --type ts --type tsx -C5

echo ""
echo "=== Search for searchParams in relevant files ==="
rg -n "searchParams" --type ts -C3

echo ""
echo "=== Full lib/utils/index.ts ==="
cat lib/utils/index.ts

echo ""
echo "=== Search for Azure env vars usage ==="
rg -n "AZURE_ENDPOINT\|AZURE_API_KEY\|AZURE_DEPLOYMENT" --type ts -C2

Length of output: 6877


🏁 Script executed:

#!/bin/bash
echo "=== Search for getSystemPrompt (no type filter) ==="
rg -n "getSystemPrompt" -C5

echo ""
echo "=== Search for getSelectedModel definition ==="
rg -n "getSelectedModel" -C4

echo ""
echo "=== Check if lib/utils/index.ts is imported in client components ==="
rg -n "from.*lib/utils" --glob "*.tsx" --glob "*.ts" -l | head -20

echo ""
echo "=== Check for 'use client' in files importing lib/utils ==="
rg -n "from.*['\"]@/lib/utils['\"]" -l | xargs -I{} sh -c 'echo "=== {} ===" && head -3 {}'

echo ""
echo "=== Check lib/actions/users for server-only usage ==="
fd "users" lib/actions/ | xargs cat 2>/dev/null || rg -rn "getSelectedModel" lib/ -C5

Length of output: 20759


🏁 Script executed:

#!/bin/bash
echo "=== All files importing getModel from lib/utils ==="
rg -n "getModel.*from.*lib/utils\|from.*lib/utils.*getModel" --glob "*.ts" --glob "*.tsx" -C1

echo ""
echo "=== Check lib/agents directory for getModel usage ==="
rg -n "getModel" lib/agents/ -C2

echo ""
echo "=== Check app/actions.tsx for getModel usage ==="
rg -n "getModel" app/actions.tsx -C2

echo ""
echo "=== Check all files importing from `@/lib/utils` for getModel ==="
rg -n "import.*getModel.*from" -C1

Length of output: 6268


@ngoiyaeric I've identified the root cause of both errors. Here's the diagnosis:


Root Cause

lib/utils/index.ts mixes server-only code with client utilities. This PR added import { getSelectedModel } from '@/lib/actions/users' (a 'use server' file that uses Next.js server APIs like noStore, revalidatePath, DB, and getCurrentUserIdOnServer) into lib/utils/index.ts.

That same lib/utils/index.ts exports cn, nanoid, and generateUUID — which are imported by 30+ client components ('use client'). When those client components bundle, they pull in the server-only code, corrupting the webpack module graph:

  • Error 1TypeError: Cannot read properties of undefined (reading 'call') — webpack can't resolve the broken server module in a client context.
  • Error 2getSystemPrompt: TypeError: Cannot read properties of undefined (reading 'searchParams') — cascades from the broken module state; getCurrentUserIdOnServer() inside the server action tries to access Next.js request context that doesn't exist in the corrupted bundle.

Fix: Move getModel() to a dedicated server-only file

  • Create lib/utils/model.ts with getModel() and all its server-only imports
  • Strip server-only imports and getModel from lib/utils/index.ts
  • Update the 8 consumer files to import from the new location

The requested changes have been implemented and a pull request has been created: View PR

- Refactored getModel in lib/utils/index.ts for better readability and robust error handling.
- Established Azure AI Foundry (GPT-5.5) as the primary provider in the default fallback chain.
- Integrated GPT-5.5 into the model selection UI with appropriate metadata.
- Updated .env.local.example with necessary Azure configuration.
- Removed redundant try-catch blocks and debug artifacts.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/utils/index.ts (1)

3-7: ⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

Move getModel out of the shared utils barrel.

Line 3 imports getSelectedModel from @/lib/actions/users, and lines 4-7 add all provider SDK imports; lines 24-135 export getModel() which uses both. This reintroduces the server/client boundary break: any client import of @/lib/utils (which 35+ client components do) will transitively pull in server-only code and all AI provider SDKs into the client bundle. Move getModel() and the AI provider imports into a server-only module.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/utils/index.ts` around lines 3 - 7, The shared utils barrel exports
getModel() and imports server-only AI SDKs (createOpenAI,
createGoogleGenerativeAI, createAmazonBedrock, createXai) which causes
server-only code to be bundled into client components; move getModel() and all
AI provider imports out of lib/utils/index.ts into a new server-only module
(e.g., lib/server/getModel.ts), update getModel() to import getSelectedModel
from '@/lib/actions/users' inside that server-only file, and change all call
sites that used getModel from the shared utils to import it from the new
server-only module so client components no longer transitively import server
SDKs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/utils/index.ts`:
- Around line 64-67: The switch branch for getModel() handling the case
'GPT-5.1' incorrectly returns the 'gpt-4o' client; update the 'GPT-5.1' case in
lib/utils/index.ts (the getModel() switch) to return/create the correct model
identifier 'gpt-5.1' (i.e., call/create the OpenAI client with 'gpt-5.1' or
return that model string), or if GPT-5.1 is not supported remove the 'GPT-5.1'
option from the UI (components/settings/components/model-selection-form.tsx) to
keep selections consistent.

---

Outside diff comments:
In `@lib/utils/index.ts`:
- Around line 3-7: The shared utils barrel exports getModel() and imports
server-only AI SDKs (createOpenAI, createGoogleGenerativeAI,
createAmazonBedrock, createXai) which causes server-only code to be bundled into
client components; move getModel() and all AI provider imports out of
lib/utils/index.ts into a new server-only module (e.g., lib/server/getModel.ts),
update getModel() to import getSelectedModel from '@/lib/actions/users' inside
that server-only file, and change all call sites that used getModel from the
shared utils to import it from the new server-only module so client components
no longer transitively import server SDKs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0f18b0e5-ef57-4be2-94a1-aee8f89b5031

📥 Commits

Reviewing files that changed from the base of the PR and between 44bffb9 and 133acf8.

📒 Files selected for processing (1)
  • lib/utils/index.ts

Comment thread lib/utils/index.ts Outdated
Comment on lines 64 to 67
case 'GPT-5.1':
if (openaiApiKey) {
const openai = createOpenAI({
apiKey: openaiApiKey,
});
const openai = createOpenAI({ apiKey: openaiApiKey });
return openai('gpt-4o');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C2 "GPT-5\.1|gpt-4o" components lib

Repository: QueueLab/QCX

Length of output: 1339


🏁 Script executed:

rg -n "GPT-5" components lib --type ts --type tsx -B 2 -A 2

Repository: QueueLab/QCX

Length of output: 84


🏁 Script executed:

rg -n "5\.1|5.1" lib --type ts -B 1 -A 1

Repository: QueueLab/QCX

Length of output: 406


🏁 Script executed:

fd -e json -e yaml -e config | head -20

Repository: QueueLab/QCX

Length of output: 315


🏁 Script executed:

cat -n config/model.json

Repository: QueueLab/QCX

Length of output: 105


🏁 Script executed:

sed -n '50,80p' lib/utils/index.ts

Repository: QueueLab/QCX

Length of output: 1069


🏁 Script executed:

sed -n '1,100p' lib/utils/index.ts | head -100

Repository: QueueLab/QCX

Length of output: 3541


🏁 Script executed:

rg -n "gpt-4o|gpt-5" . --type ts -i

Repository: QueueLab/QCX

Length of output: 916


GPT-5.1 case returns gpt-4o instead of the selected model.

When a user selects "GPT-5.1" from the model selection UI (components/settings/components/model-selection-form.tsx:54-55), the getModel() function silently serves gpt-4o instead (lib/utils/index.ts:67). This creates a mismatch between what the UI advertises and what is actually returned. Change line 67 to return the correct model identifier (gpt-5.1) or remove the GPT-5.1 option from the UI if it is not intended.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@lib/utils/index.ts` around lines 64 - 67, The switch branch for getModel()
handling the case 'GPT-5.1' incorrectly returns the 'gpt-4o' client; update the
'GPT-5.1' case in lib/utils/index.ts (the getModel() switch) to return/create
the correct model identifier 'gpt-5.1' (i.e., call/create the OpenAI client with
'gpt-5.1' or return that model string), or if GPT-5.1 is not supported remove
the 'GPT-5.1' option from the UI
(components/settings/components/model-selection-form.tsx) to keep selections
consistent.

- Added GPT-5.5 to the ModelSelectionForm UI.
- Created lib/utils/model.ts and refactored getModel to support Azure Foundry.
- Prioritized Azure in the model fallback chain.
- Fixed Next.js 15 async cookies issue in lib/auth/get-current-user.ts.
- Updated all agent import paths for getModel.
- Updated .env.local.example with Azure configuration variables.

Co-authored-by: ngoiyaeric <115367894+ngoiyaeric@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants